#include<iostream>
#include<cstring>
using namespace std;
const int SIZE = 1005;
int main(int argc, char const *argv[])
{
    freopen("test.txt","r",stdin);
    char s[SIZE]{0};
    scanf("%[^\n]",s);
    int L = strlen(s);
    int res = 0;
    for(int i = 0;i<2*L-1;++i)
    {
        for(int j = (i+1)/2; i-j>=0 && j<L ;++j)
        {
            if(s[j]!=s[i-j]) break;
            res = res < 2*j-i+1 ? 2*j-i+1:res;
        }
    }

    cout<<res;

    return 0;
}
